home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 25 / CU Amiga Magazine's Super CD-ROM 25 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-08].iso / CUCD / Magazine / C_Tutorial / Part-13 / PatchLib / source / RemovePatchHandler.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-02  |  1.2 KB  |  63 lines

  1. /*
  2. **    patch.library
  3. **
  4. **    Copyright © 1993-1997 by Stefan Fuchs
  5. **        Freely distributable.
  6. */
  7.  
  8. #ifndef _PATCH_INCLUDES_H
  9. #include "patch_includes.h"
  10. #endif
  11.  
  12.  
  13. /****i* patch.library/RemovePatchHandler ***************************************
  14. *
  15. *   NAME
  16. *        RemovePatchHandler -- Remove any removable patches. (PRIVATE)
  17. *
  18. *   SYNOPSIS
  19. *        RemovePatchHandler( )
  20. *
  21. *        RemovePatchHandler( void);
  22. *
  23. *   FUNCTION
  24. *        Test all patches, which are pending for removal, if they can
  25. *        be removed now. If so deallocate all associated memory and
  26. *        structures. This function is called by the low-memory handler,
  27. *        InstallPatchTags() and RemovePatchTags().
  28. *
  29. *   INPUTS
  30. *
  31. *   TAGS
  32. *
  33. *   RESULT
  34. *
  35. *   NOTES
  36. *
  37. *   BUGS
  38. *
  39. *   SEE ALSO
  40. *
  41. ******************************************************************************
  42. *
  43. */
  44.  
  45. void LIBFUNC RemovePatchHandler( )
  46. {
  47. struct Node *pointer;
  48. struct MasterPatch *master;
  49.  
  50.     if( AttemptSemaphore(&(PatchBase->PB_Semaphore)))
  51.     {
  52.         for (pointer = (struct Node *) PatchBase->PB_MasterPatchHeader.lh_Head;
  53.              pointer->ln_Succ;)
  54.         {
  55.  
  56.             master = (struct MasterPatch *)pointer;
  57.             pointer = (struct Node *)pointer->ln_Succ;
  58.             RemoveSystemNodeWithTest( master);
  59.         }
  60.         ReleaseSemaphore(&(PatchBase->PB_Semaphore));
  61.     }
  62. }
  63.